//
//  LotteryDetailsTableViewCell.m
//  PlayerWorld
//
//  Created by 1 on 16/5/12.
//  Copyright © 2016年 刘成. All rights reserved.
//
#define UISCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#import "LotteryDetailsTableViewCell.h"

@implementation LotteryDetailsTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 开奖期数
        self.lotteryDetailsLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, 120, 20)];
        self.lotteryDetailsLabel.font = [UIFont systemFontOfSize:12];
        self.lotteryDetailsLabel.text = @"第20160825-023期";
        self.lotteryDetailsLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.lotteryDetailsLabel];
        
        // 开奖时间
        self.lotteryDetailsLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.lotteryDetailsLabel.frame), 10, UISCREEN_WIDTH-10-CGRectGetMaxX(self.lotteryDetailsLabel.frame), 20)];
        self.lotteryDetailsLabel2.font = [UIFont systemFontOfSize:12];
        self.lotteryDetailsLabel2.text = @"2015-07-08 14:05:00";
        self.lotteryDetailsLabel2.textColor = [UIColor grayColor];
        self.lotteryDetailsLabel2.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:self.lotteryDetailsLabel2];
        
        // 开奖数字图片
        self.lotteryNumber1Button = [[UIButton alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(self.lotteryDetailsLabel.frame)+10, 40, 40)];
        [self.lotteryNumber1Button setBackgroundImage:[UIImage imageNamed:@"icon_ball_cyan"] forState:UIControlStateNormal];
        [self.lotteryNumber1Button setTitle:@"6" forState:UIControlStateNormal];
        [self.contentView addSubview:self.lotteryNumber1Button];
        
        self.lotteryNumber2Button = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.lotteryNumber1Button.frame)+5, CGRectGetMaxY(self.lotteryDetailsLabel.frame)+10, 40, 40)];
        [self.lotteryNumber2Button setBackgroundImage:[UIImage imageNamed:@"icon_ball_cyan"] forState:UIControlStateNormal];
        [self.lotteryNumber2Button setTitle:@"2" forState:UIControlStateNormal];
        [self.contentView addSubview:self.lotteryNumber2Button];
        
        self.lotteryNumber3Button = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.lotteryNumber2Button.frame)+5, CGRectGetMaxY(self.lotteryDetailsLabel.frame)+10, 40, 40)];
        [self.lotteryNumber3Button setBackgroundImage:[UIImage imageNamed:@"icon_ball_cyan"] forState:UIControlStateNormal];
        [self.lotteryNumber3Button setTitle:@"1" forState:UIControlStateNormal];
        [self.contentView addSubview:self.lotteryNumber3Button];
        
        self.lotteryNumber4Button = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.lotteryNumber3Button.frame)+5, CGRectGetMaxY(self.lotteryDetailsLabel.frame)+10, 40, 40)];
        [self.lotteryNumber4Button setBackgroundImage:[UIImage imageNamed:@"icon_ball_cyan"] forState:UIControlStateNormal];
        [self.lotteryNumber4Button setTitle:@"0" forState:UIControlStateNormal];
        [self.contentView addSubview:self.lotteryNumber4Button];
        
        self.lotteryNumber5Button = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.lotteryNumber4Button.frame)+5, CGRectGetMaxY(self.lotteryDetailsLabel.frame)+10, 40, 40)];
        [self.lotteryNumber5Button setBackgroundImage:[UIImage imageNamed:@"icon_ball_cyan"] forState:UIControlStateNormal];
        [self.lotteryNumber5Button setTitle:@"6" forState:UIControlStateNormal];
        [self.contentView addSubview:self.lotteryNumber5Button];
        
        // 开奖时间
        UILabel *twoSmallLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.lotteryDetailsLabel2.frame), CGRectGetMaxY(self.lotteryDetailsLabel2.frame)+20, UISCREEN_WIDTH-10-CGRectGetMaxX(self.lotteryDetailsLabel.frame), 20)];
        twoSmallLabel.font = [UIFont systemFontOfSize:12];
        twoSmallLabel.text = @"大双|小双";
        twoSmallLabel.textColor = [UIColor grayColor];
        twoSmallLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:twoSmallLabel];

    }
    return self;
}


@end
